<template lang="pug">
	.main-agreement-wrap
		.radio-wrap(@click="agreementChange")
			.agreement-icon(:class="{'agreement-icon-active': checked}")
			.agreement-label 我已阅读并同意
				span(@click="jumpToAgreementInfo") 《{{agreementName}}》
</template>
<script>
export default {
	data() {
		return {
			checked: false
		}
	},
	props: {
		agreementUrl: {
			type: String,
			default: ''
		},
		agreementName: {
			type: String,
			default: ''
		}
	},
	computed: {},
	mounted() {},
	onPullDownRefresh() {},
	onReachBottom() {},
	methods: {
		jumpToAgreementInfo() {
			this.wx.setStorage({
				key: 'jumpUrl',
				data: {
					url: this.agreementUrl,
					title: this.agreementName,
					params: {
						stype: 'app'
					}
				}
			})
			this.$router.push({
				path: '/views/webview/webview'
			})
		},
		agreementChange(e) {
			this.checked = !this.checked
			this.$emit('getAgreementMode', this.checked)
		}
	},
	watch: {},
	components: {}
}
</script>

<style lang="stylus">
	.radio-wrap
		margin-top 30px
		display flex
		align-items center
		justify-content center
	.agreement-icon
		background-color blue
		width 34px
		height 34px
		margin-right 2px
		centerBackground("../../assets/image/common/icon_agree_no.png")
	.agreement-icon-active
		centerBackground("../../assets/image/common/icon_agree.png")
	.agreement-label
		color blackFontColor4C
		font-size 26px
		line-height 36px
		span
			color themeColor
</style>
